package org.stvd.entities.admin;

import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import org.stvd.core.annotation.serializer.DateTimeSerializer;
import org.stvd.entities.base.BaseEntity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * @Title: DictionaryType
 * @Description: 字典类型-实体类
 * @author houzx
 * @date 2020年2月7日
 */
@Entity
@Table(name = "dictionary_type")
public class DictionaryType extends BaseEntity{

    private static final long serialVersionUID = -3789968549192991417L;
    
    @Id
    @Column(name="id", nullable = false)
    @NotEmpty(message="类型ID不能为空")
    @Length(max=20, message="类型ID最大可输入20个字符")
    private String id = "";
    
    /**
     * 类型名称
     */
    @Column(name="name", nullable = false)
    @NotEmpty(message="类型名称不能为空")
    @Length(max=20, message="类型名称最大可输入20个字符")
    private String name = "";
    
    /**
     * 备注说明
     */
    @Column(name="remark")
    @Length(max=200, message="类型描述最大可输入200个字符")
    private String remark = "";
    
    /**
     * 编号
     */
    @Column(name= "serial_no", nullable = false)
    @NotNull(message="排序编号不能为空")
    @Max(value = 999999999, message="排序编号最大为999999999")
    @Min(value = 0, message="排序编号最小为0")
    private Integer serialNo = null;

    /**
     * 创建人
     */
    @Column(name="create_user", nullable = false)
    private String createUser = "";
    
    /**
     * 创建时间
     */
    @Column(name="create_time", nullable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date createTime = null;
    
    /**
     * 更新时间
     */
    @Column(name="modify_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date modifyTime = null;
    
    @Transient
    private String oldId = "";
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(Integer serialNo) {
        this.serialNo = serialNo;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getOldId() {
        return oldId;
    }

    public void setOldId(String oldId) {
        this.oldId = oldId;
    }
}
